;; -------- org-mode --------
(setq org-startup-indented t)
(setq-default org-display-custom-times t)
;; (setq org-time-stamp-custom-formats '("<%a %b %e %Y>" . "<%a %b %e %Y %H:%M>"))
(setq org-time-stamp-custom-formats '("<%Y-%m-%d, %w>" . "<%a %b %e %Y %H:%M>"))

(add-hook 'org-mode-hook
          (lambda ()
            (diminish 'org-indent-mode)
            ;; use inline format for CN, via: emacs-china.org/t/orgmode/9740/17
            (setq org-emphasis-regexp-components '("-[:multibyte:][:space:]('\"{" "-[:multibyte:][:space:].,:!?;'\")}\\[" "[:space:]" "." 1))
            (org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)
            (org-element-update-syntax)
            ;; sub super script be added {}
            (setq org-use-sub-superscripts "{}")
            (setq org-export-with-sub-superscripts '{})
            ;; highlight sub super script
            (setq org-highlight-latex-and-related '(native script entities)
                  org-pretty-entities t
                  org-pretty-entities-include-sub-superscripts t)))

;; (add-hook 'org-mode-hook
;;           (lambda ()
;;             ;; (require 'org-tempo)
;;             (local-set-key (kbd "C-c o s") #'p1uxtar-org-insert-src)))

;; (fset 'p1uxtar-org-insert-src
;;       (lambda (&optional arg)
;;         "Keyboard macro."
;;         (interactive "p")
;;         (kmacro-exec-ring-item
;;          (quote ([35 kp-add 66 69 71 73 78 95 83 82 67 return 35 kp-add 69 78 68 95 83 82 67 16 5 32] 0 "%d"))
;;          arg)))

;; org-babel
(with-eval-after-load 'org
  (org-babel-do-load-languages
   'org-babel-load-languages '((C . t)
                               (emacs-lisp . t)
                               (latex . t)
                               (python . t)
                               (R . t)
                               (shell . t)))
  (setq org-confirm-babel-evaluate nil))

(provide '+org-mode)
